<div class="container col-sm-12" ng-controller="mainCtrl" ng-click="cancelRefer()">
  <h3><small><a href="/project/index.html">首页</a>&nbsp;&gt;&nbsp;</small>//projectName//</h3>
  <form name="form">
    登录接口：
    <input type="text" ng-model="loginUrl" validator="path" placeholder="URL" style="width:325px;" ng-init="loginUrl='/'">
    <input type="text" ng-model="loginObj" validator="jsonString" placeholder="请求参数" ng-init="loginObj='{}'" style="width:400px;margin-top:5px;display:block;">
    测试接口的服务器地址：
    <input type="text" style="margin-top:5px;min-width:200px;width://(backendUrl.length*7)+'px'//" ng-model="backendUrl" validator="url" placeholder="如 http://192.168.199.1/zsd"  >
    <button ng-click="saveUrl()" class="btn btn-primary btn-xs">保存</button>
  </form>
  <div>
    <div class="pull-right">
      <a href="javascript:void(0);" ng-click="sort('');">默认</a>&emsp;
      <a href="javascript:void(0);" ng-click="sort('name');">按名称&uarr;</a>&emsp;
      <a href="javascript:void(0);" ng-click="sort('updateDate');">按日期&darr;</a>
    </div>
    <div class="clearfix"></div>
    <br>
    <div class="panel panel-default" ng-repeat="m in modules">
      <div class="panel-heading">
        <span ng-bind="m.name" ng-hide="m.text" placeholder="模块名称"></span>
        {{#if editable}}
          <input id="_moduleName" type="text" ng-model="m.text" ng-if="m.text" ng-keydown="keydown($event, m);" ng-blur="cancel(m)">
          <a href="javascript:void(0);" title="双击删除" ng-hide="m.text" ng-dblclick="remove(m._id);" class="pull-right text-danger glyphicon glyphicon-minus">双击删除&nbsp;</a>
          <a href="javascript:void(0);" ng-hide="m.text" ng-click="edit(m)" class="pull-right text-warning glyphicon glyphicon-edit">编辑&nbsp;</a>
        {{/if}}
      </div>
      <div class="panel-body">
        <table class="table">
          <tr>
            <th>接口名称（版本）</th>
            <th>请求路径</th>
            <th>请求方式</th>
            <th>修改者</th>
            <th>修改日期</th>
            <th>登录授权</th>
            <th></th>
            <th></th>
            <th></th>
            <th>状态</th>
          </tr>
          <tr ng-repeat="i in m.interfaces">
            <td>
              <a target="_blank" href="/interface/index.html?pid=//m.pid//&mid=//m._id//&projectName=//projectName//&moduleName=//m.name//&editable=0#//i._id//" ng-bind="i.name+'('+i.version+')'"></a>
            </td>
            <td ng-bind="i.url"></td>
            <td ng-bind="i.method"></td>
            <td ng-bind="i.author"></td>
            <td ng-bind="i.updateDate"></td>
            <td ng-bind="'true'==i.login?'是':'否'"></td>
            <td><a ng-if="i.inObject" href="" ng-click="showParam(i.name, i.inObject)" data-toggle="modal" data-target="#myModal">参数</a></td>
            <td><a ng-if="i.outObject" href="" ng-click="showParam(i.name, i.outObject)" data-toggle="modal" data-target="#myModal">返回值</a></td>
            <td style="text-align:right;">
              {{#if editable}}
                <a target="_blank" href="/interface/index.html?pid=//m.pid//&mid=//m._id//&projectName=//projectName//&moduleName=//m.name//#//i._id//" class="text-warning"><span class="glyphicon glyphicon-edit"></span>编辑</a>
                <a href="" title="双击删除" ng-dblclick="deleteInterface(i._id, m.interfaces)" class="text-danger"><span class="glyphicon glyphicon-minus"></span>双击删除</a>
              {{/if}}
            </td>
            <td>
              <span data-toggle="modal" data-target="#myModal" ng-click="testInterface(i._id)" ng-if="!i.testStatus" class="label label-warning" style="cursor:pointer;" title="操作：点击进行接口测试并保存，可修改状态~&#10;描述：未连接后端服务器进行测试，可能无法正常使用。&#10;测试者：//i.testUser//&#10;测试日期：//i.testTime//&#10;消耗时间： //i.costTime//">未测试</span>
              <span data-toggle="modal" data-target="#myModal" ng-click="testInterface(i._id)" ng-if="1==i.testStatus" class="label label-success" style="cursor:pointer;" title="操作：点击进行接口测试并保存，可修改状态~&#10;描述：已通过后端服务器测试。&#10;测试者：//i.testUser//&#10;测试日期：//i.testTime//&#10;消耗时间：//i.costTime//">通过</span><span ng-if="1==i.testStatus" ng-bind="i.costTime"></span>
              <span data-toggle="modal" data-target="#myModal" ng-click="testInterface(i._id)" ng-if="-1==i.testStatus" class="label label-danger" style="cursor:pointer;" title="操作：点击进行接口测试并保存，可修改状态~&#10;描述：接口返回值未通过规则校验。&#10;测试者：//i.testUser//&#10;测试日期：//i.testTime//&#10;消耗时间：//i.costTime//">失败</span><span ng-if="-1==i.testStatus" ng-bind="i.costTime"></span>
            </td>
          </tr>
          {{#if editable}}
            <tr>
              <td colspan="10" class="text-center">
                <a href="/interface/index.html?pid=//m.pid//&mid=//m._id//&projectName=//projectName//&moduleName=//m.name//" target="_blank" class="glyphicon glyphicon-plus text-success">新增接口</a>
              </td>
            </tr>
          {{/if}}
        </table>
      </div>
    </div>
    {{#if editable}}
      <div class="panel panel-default">
        <div class="panel-heading text-center"><a class=" text-success" href="javascript:void 0;" ng-click="edit();"><span class="glyphicon glyphicon-plus"></span>新增模块</a></div>
        <div class="panel-body" ng-if="mod">
          <input type="text" id="moduleName" placeholder="模块名称" class="form-control" ng-model="mod.name" ng-keydown="keydown($event);" ng-blur="cancel()">
        </div>
      </div>
    {{/if}}
    <div ng-if="message" class="alert alert-danger" role="alert">
      <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
      <span class="sr-only">Error:</span> //message//
    </div>
  </div>
  <!-- Modal -->
  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="myModalLabel"><b ng-bind="modalTitle" class="//modalClass//"></b></h4>
        </div>
        <textarea id="modalContent" readonly="" style="width: 100%;height: 600px;font-size:16px;" class="modal-body" ng-bind="modalContent">
        </textarea>
        <div class="modal-footer">
          <button ng-show="xhr" type="button" class="btn btn-default" data-dismiss="modal" ng-click="saveTest();">保存结果</button>
          <button ng-show="!xhr" type="button" class="btn btn-default" data-dismiss="modal" ng-click="copy();">点击复制</button>
        </div>
      </div>
    </div>
  </div>

</div>
